<!DOCTYPE html>
<html lang="zh-cn">

<head>
    <meta charset="utf-8" />
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta content="telephone=no" name="format-detection">
    <meta name="viewport" content="width=device-width,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
    <meta name="apple-mobile-web-app-capable" content="yes" />
    <title>AI盯盘助手</title>
    <link rel="stylesheet" href="css/main.css">
    <link rel="stylesheet" href="css/base.css">
</head>

<body>
    <div id="container">
        <!-- 历史策略收益 -->
        <div class="homeBody">
            <div class="title">
                <img src="images/icon-sy.png" alt="">
            </div>
            <div class="records_list_echerts">
                <div class="head-tab">
                    <p class="all" data-id=3>
                        <span>全部</span>
                    </p>
                    <div class="fr">
                        <div class="week">
                            <p class="name">近一周 </p>
                            <p class='zf'>
                                <span class="status"></span>
                                <span class='num'></span><em></em>
                            </p>
                        </div>
                        <div class="month">
                            <p class="name">近一个月 </p>
                            <p class='zf'>
                                <span class="status"></span>
                                <span class='num'></span><em></em>
                            </p>
                        </div>
                    </div>
                </div>

                <div class="cont">
                    <div class="cont-tab">
                        <ul class="cont-tab-line">
                            <div id="All" style="width: 6.3rem;height:4.8rem;"></div>
                        </ul>
                    </div>
                </div>

            </div>
        </div>
        <!-- 收益历史记录 -->
        <div class="Income_recordmain">
            <div class="Income_record">
                <table class='Records_list'>
                    <thead>
                        <th>名称代码</th>
                        <th>入选时间</th>
                        <th>剔除时间</th>
                        <th>周期涨跌幅</th>
                    </thead>
                    <tbody></tbody>
                </table>
                <div class='more' onclick="location.href = 'Allhistorical_Records.html'">查看更多历史记录</div>
            </div>
        </div>
        <!-- 了解收盘姐 -->
        <div class="know_spj">
            <div class="title">
                <img src="images/icon_lj.png" alt="">
            </div>
            <div class="coninfo">
                运用大数据+AI人工智能算法，精选多种股票投资策略，一站式解决中小资金用户选股难的问题。
            </div>
            <div class="ewm">
                <img src="images/icon_ewm.jpg" alt="">
                <p>搜索擒龙高手关注我们</p>
            </div>
            <div class="statement">声明：仅供参考，不做投资建议，请勿盲目跟买</div>
        </div>
    </div>
</body>
<script src="js/jquery.js"></script>
<script src="js/rem.js"></script>
<script src="https://cdn.bootcss.com/echarts/4.2.1-rc1/echarts.js"></script>
<script src="https://unpkg.com/axios/dist/axios.min.js"></script>
<script>
    var baseurl = "https://dpb002.applinzi.com"
    var option = {
        tooltip: {
            trigger: 'axis',
            // formatter:'{b0}<br/>{a0}: {c0}%<br/>{a1}: {c1}%'
        },
        itemStyle: {
            normal: {
                color: '#46bee9',
                shadowBlur: 10,
                shadowColor: '#46bee9'
            }
        },
        grid: {
            left: "3%",
            right: '6%',
            // bottom: 30,
            containLabel: true,
            top: 20,
        },
        xAxis: {
            type: 'category',
            boundaryGap: false,
            axisLabel: {
                interval: 1,
                rotate: -100,
                margin: 15,
                textStyle: {
                    color: "#666666"
                }
            },
            data: []
        },
        //初始化滚动条
        dataZoom: [{
          type: 'slider',
          show: true,
          xAxisIndex: [0],
          bottom: 10,
          start: 10,
          end: 90
        }],

        yAxis: {
            type: 'value'
        },
        legend: {
            selectedMode: false,
            data: ['累计总收益', '当日收益', '上证指数'],
            bottom: 10,
        },
        series: [{
                name: '累计总收益',
                type: 'line',
                left: 0,
                // data: [120, 132, 101, 134, 90, 230, 210]
            },
            {
                name: '当日收益',
                symbol: "none",
                type: 'line',
                lineStyle: {
                    width: 0, // 线宽是0
                    color: 'rgba(0, 0, 0, 0)' // 线的颜色是透明的
                }
            },
            {
                name: '上证指数',
                type: 'line',
                // data: [820, 932, 901, 934, 1290, 1330, 1320]
            },
        ]
    };
    //图表数据
    function allData(cb) {
        axios.get(baseurl + '/forward/stockIncubatorData', {
                params: {
                    account: 001
                }
            })
            .then(function(res) {
                cb && cb(res)
            })
            .catch(function(error) {
                console.error(error);
            });
    }
    allData(function(res) {
        console.log(res)
        //初始化图表
        option.xAxis.data = res.data.dateList
        option.series[0].data = res.data.profitList
        option.series[1].data = res.data.szzsProfitList
        option.series[2].data = res.data.dateProfitList
        var myChart = echarts.init(document.getElementById('All'));
        myChart.setOption(option);
        window.onresize = myChart.resize;

        // 一个月的收益、一周的收益
        var week_zf = document.querySelector('.records_list_echerts .head-tab .week .zf .num');
        var month_zf = document.querySelector('.records_list_echerts .head-tab .month .zf .num');
        $('.records_list_echerts .head-tab .week .zf em').text('%')
        $('.records_list_echerts .head-tab .month .zf em').text('%')
        if (res.data.weekTotalProfit >= 0) {
            $('.records_list_echerts .head-tab .week .zf').addClass('up')
            $('.records_list_echerts .head-tab .week .zf .status').text('+')
            week_zf.innerHTML = res.data.weekTotalProfit.toFixed(1);
        } else {
            $('.records_list_echerts .head-tab .week .zf').addClass('down')
            // $('.records_list_echerts .head-tab .week .zf .status').text('-')
            week_zf.innerHTML = res.data.weekTotalProfit.toFixed(1);
        }

        if (res.data.monthTotalProfit >= 0) {
            $('.records_list_echerts .head-tab .month .zf').addClass('up')
            $('.records_list_echerts .head-tab .month .zf .status').text('+')
            month_zf.innerHTML = res.data.monthTotalProfit.toFixed(1);
        } else {
            $('.records_list_echerts .head-tab .month .zf').addClass('down')
            // $('.records_list_echerts .head-tab .month .zf .status').text('-')
            month_zf.innerHTML = res.data.monthTotalProfit.toFixed(1);
        }

        //插入历史记录数据
        var str = "";
        var trList = document.querySelector('.Income_recordmain .Records_list tbody');
        var historyList = res.data.soldOutList;
        for (let i = 0; i < 5; i++) {
            str += " <tr><td class='firstd'> <span class='name'>" + historyList[i].name +
                "</span> <span class='num'>" +
                historyList[i].code + "</span> </td> <td>" + historyList[i].begin_date + "</td> <td>" +
                historyList[i].end_date + "</td> "
            if (historyList[i].profit >= 0) {
                str += "<td class = 'lasttd up' > " + (new Number(historyList[i].profit)).toFixed(1) + '%' + " </td>"
            } else {
                str += " <td class = 'lasttd down' > " + (new Number(historyList[i].profit)).toFixed(1) + '%' + "</td>"
            }
            str += "</tr>"
        }
        trList.innerHTML = str
    })
    // 更多历史记录
</script>
<!-- 微信分享 -->
<script src="https://res.wx.qq.com/open/js/jweixin-1.2.0.js"></script>
<script>
    function initShare() {
        var targetUrl = window.location.href.split("#")[0]; // 当前分享页面请求的url,取#号之前的地址
        $.ajax({
            type: "post",
            url: baseurl + "/forward/share?init_url=" + escape(targetUrl),
            dataType: "json",
            success: function(res) {
                if (res && wx) {
                    var data = res;
                    //初始化微信配置
                    wx.config({
                        debug: false,
                        appId: data.appId,
                        timestamp: data.timestamp,
                        nonceStr: data.nonceStr,
                        signature: data.signature,
                        jsApiList: [
                            'checkJsApi',
                            'onMenuShareTimeline',
                            'onMenuShareAppMessage'
                        ]
                    });

                    wx.ready(function() {
                        /**
                         * Created by xiezl on 2018/2/9 14:33. 判断当前客户端版本是否支持指定JS接口
                         */
                        wx.checkJsApi({
                            jsApiList: ['onMenuShareTimeline', 'onMenuShareAppMessage'], // 需要检测的JS接口列表，所有JS接口列表见附录2,
                            success: function(res) {
                                // 以键值对的形式返回，可用的api值true，不可用为false
                                // 如：{"checkResult":{"chooseImage":true},"errMsg":"checkJsApi:ok"}
                                console.log("检验是否支持接口：" + res);
                            }
                        });
                        wx.onMenuShareTimeline({
                            title: "炒股又亏了？一个倔强小韭菜的逆袭之旅", // 分享标题 
                            desc: "只要功夫深 铁杵磨成针", // 分享描述 
                            link: window.location.href, // 分享链接，该链接域名或路径必须与当前页面对应的公众号JS安全域名一致 
                            imgUrl: "https://mmbiz.qpic.cn/mmbiz_jpg/90AbP4dzN10Ur93r7jiaDQONRL1L3zG3aDibfvlm4dZpKzdWpvXiay2XKzbX39uKFPNo2S5UMPyI1HNaEiaVDuqr4A/0?wx_fmt=jpeg", // 分享图标 
                            success: function() {
                                // alert("成功") 
                                // 用户点击了分享后执行的回调函数 
                            }
                        });
                        wx.onMenuShareAppMessage({
                            title: "炒股又亏了？一个倔强小韭菜的逆袭之旅", // 分享标题 
                            desc: "只要功夫深 铁杵磨成针", // 分享描述 
                            link: window.location.href, // 分享链接，该链接域名或路径必须与当前页面对应的公众号JS安全域名一致 
                            imgUrl: "https://mmbiz.qpic.cn/mmbiz_jpg/90AbP4dzN10Ur93r7jiaDQONRL1L3zG3aDibfvlm4dZpKzdWpvXiay2XKzbX39uKFPNo2S5UMPyI1HNaEiaVDuqr4A/0?wx_fmt=jpeg", // 分享图标 
                            type: '', // 分享类型,music、video或link，不填默认为link 
                            dataUrl: '', // 如果type是music或video，则要提供数据链接，默认为空 
                            success: function() {
                                // alert("成功") 
                                // 用户点击了分享后执行的回调函数 
                            }
                        });
                    });

                    wx.error(function(res) {
                        alert("验证失败:" + res.errMsg);
                    });
                }
            },
            error: function(XMLHttpRequest, textStatus, errorThrown) {
                alert("error ....." + errorThrown);
            }
        });
    }
    initShare();
</script>

</html>